package com.tianjin.weight.utils;

import com.tianjin.weight.service.RedisService;
import com.tianjin.weight.service.base.PermissionService;
import com.tianjin.weight.service.base.RoleService;
import org.springframework.stereotype.Component;

@Component
public class ServiceBeanUtils{
    public static RedisService getRedisService(){
        return getBean(RedisService.class);
    }

    public static TokenSettings getTokenSettings(){
        return getBean(TokenSettings.class);
    }

    public static RoleService getRoleService(){return getBean(RoleService.class);}

    public static PermissionService getPermissionService(){return getBean(PermissionService.class);}

    public static Object getBean(String name){
        return BaseBeanUtils.getApplicationContext().getBean(name);
    }

    public static <T> T getBean(Class<T> clazz){
        return BaseBeanUtils.getApplicationContext().getBean(clazz);
    }


    public static <T> T getBean(String name,Class<T> clazz){
        return BaseBeanUtils.getApplicationContext().getBean(name,clazz);
    }


}
